package com.zcpt.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/portal")
public class LoginController {
    @RequestMapping("username")
    public Map username(){
        String username = SecurityContextHolder.getContext().getAuthentication().getName();
        System.out.println(username+"---------------------");
        Map map = new HashMap();
        map.put("username", username);
        return map;
    }
}
